package com.esun.cheetah.biz.personal.attention;

import java.util.HashMap;

import org.json.JSONException;

import android.os.Handler;
import android.os.Message;

import com.esun.cheetah.config.BizCode;
import com.esun.cheetah.config.Config;
import com.esun.cheetah.config.Key;
import com.esun.cheetah.model.match.matchlist.Match;
import com.esun.cheetah.network.AbsInferiorityCommunicater;

/**
 * 取消关注球队 com.esun.cheetah.view.personal.CancelAttenTeam
 * 
 * @author 任付江create at 2012-4-23 上午11:30:16
 */
public class CancelAttenMatch extends AbsInferiorityCommunicater {
	/** 标志id */
	private String id;
	/**
	 * 用于比赛列表取消关注时更新本地数据
	 */
	private Match match;
	

	public CancelAttenMatch(Handler handler, String id) {
		super(handler);
		this.id = id;
	}

	public CancelAttenMatch(Handler handler, Match match){
		super(handler);
		this.id = match.getMatchId();
		this.match = match;
	}
	
	@Override
	public HashMap<String, String> comHashMap() {
		HashMap<String, String> cancelAttenTeam = new HashMap<String, String>();
		cancelAttenTeam.put(Key.KEY_ID, BizCode.DELETE_ATTEN_MATCH);
		cancelAttenTeam.put(Key.KEY_USERNAME, "testphone");
		cancelAttenTeam.put(Key.KEY_MATC_ID, id);
		return cancelAttenTeam;
	}

	@Override
	public void getJsonContent(String serverRes) throws JSONException {
	}

	@Override
	public void getServerResponseSuccess() {
			//AttentionListManager.getInstance().setAttentionListAdded(true);
		
			Message msg = handlerFromAct.obtainMessage(Config.COMMUNICATER_SUCCESS);
			if(match != null){
				msg.obj = match;
			}
			
			handlerFromAct.sendMessage(msg);
		}

}